<template>
  <div class="top_header">
    这是头部
    <el-button
      v-for="(val, index) in list"
      :key="index"
      @click="golink(val.name)"
      >{{ val.msg }}</el-button
    >
    <el-button @click="clearAll()">退出</el-button>
  </div>
</template>

<script>
export default {
  name: "Header",
  inject: ["reload"],
  data() {
    return {
      list: [
        {
          msg: "主页",
          name: "Home"
        },
        {
          msg: "数组排列组合 A系",
          name: "jsArrayA"
        },
        {
          msg: "数组排列组合 取交",
          name: "jsArrayJJ"
        },
        {
          msg: "关于",
          name: "About"
        }
      ]
    };
  },
  methods: {
    getSome() {
      this.reload();
    },
    golink(name) {
      this.$router.push({ name });
    },
    clearAll() {
      localStorage.clear();
      location.reload();
    }
  }
};
</script>

<style lang="scss">
.top_header {
  background-color: #000;
  color: aqua;
  width: 100%;
  height: 60px;
  line-height: 60px;
  text-align: center;
}
</style>
